package com.hg.chapter932;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
public class Chapter932Application implements CommandLineRunner {

	@Autowired
	RabbitTemplate rabbitTemplate;

	//生成目的地
//	@Bean
//	public org.springframework.amqp.core.Queue get(){
//		return new org.springframework.amqp.core.Queue("my-queue");
//	}

	public static void main(String[] args) {
		SpringApplication.run(Chapter932Application.class, args);
	}

	@Override
	public void run(String... args) throws Exception {
		rabbitTemplate.convertAndSend("my-queue","来自Rabbit发送消息");
	}
}
